package com.example.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.entity.Mycoupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 爪哇岛主
 * @since 2024-07-03
 */
public interface MycouponMapper extends BaseMapper<Mycoupon> {


    @Select("SELECT * FROM mycoupon LIMIT #{pageNum}, #{pageSize}")
    List<Mycoupon> listCouponsByPage(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);


    @Select("SELECT COUNT(*) FROM mycoupon")
    int countTotalCoupons();




    @Select("SELECT * FROM mycoupon WHERE mycoupon_id = #{mycouponId}")
    List<Mycoupon> searchCoupons(@Param("mycouponId") Integer mycouponId);




    List<Mycoupon> selectCouponsPaged(@Param("page")Page<Mycoupon> page);





}
